<?php
/*
 * profile main content.
 * cookie will store user id. ie. id of child account.
 */
//echo '1';
include 'all.php';
include '../../include/config.php';
$result = mysql_query("select * from baby_child_profile_detail where bid = " . $_COOKIE['bid'] . "") or die(mysql_error());

while ($row1 = mysql_fetch_array($result)) {
    ?>
    <form action="../profile/updater.php" method="post">
        <div class="color_blue padding_title">BASIC DATA INFO OF <?php echo $actor; ?></div>
        <div class="padding_5"> <div class="float_left edit_profile">Name</div><div class="display_data_strong"><input type="text" name="name" value="<?php echo $row1['name'] ?>"/>&nbsp;</div><div class="clear"></div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Sur name</div><div  class="display_data_strong"><input type="text" name="sur_name" value="<?php echo $row1['sur_name'] ?>"/>&nbsp;</div><div class="clear"></div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Sex</div><div style="color:#454545;font-size: 12px;font-weight: bold"><input type="text" name="sex" value="<?php echo $row1['sex'] ?>"/>&nbsp;</div><div class="clear"></div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Date of birth(yyyy-mm-dd)</div><div  class="display_data_strong"><input type="text" name="date_of_birth" value="<?php echo $row1['date_of_birth'] ?>"/>&nbsp;</div><div class="clear"></div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Address</div><div class="display_data_strong"><input type="text" name="address" value="<?php echo $row1['address'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Zip Code</div><div  class="display_data_strong"><input type="text" name="zip_code" value="<?php echo $row1['zip_code'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">City</div><div  class="display_data_strong"><input type="text" name="city" value="<?php echo $row1['city'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">District</div><div  class="display_data_strong"><input type="text" name="district" value="<?php echo $row1['district'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Nation</div>
            <div  class="display_data_strong">
                <select name="country">
                    <?php
                    $cnt1 = mysql_query("select * from fa_country") or die(mysql_error());
                    while ($row3 = mysql_fetch_array($cnt1)) {
                        ?>
                        <option value="<?= $row3['id'] ?>" <?php if ($row1['country'] == $row3['id']) { ?> selected="selected"  <?php } ?>  > <?= $row3['name'] ?></option> 
                    <?php }
                    ?>
                </select>
                &nbsp;
            </div>
        </div>
        <div class="padding_5"> <div class="float_left edit_profile">Home phone nr.</div><div  class="display_data_strong"><input type="text" name="phone" value="<?php echo $row1['phone'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Mobile phone nr.</div><div  class="display_data_strong"><input type="text" name="mobile" value="<?php echo $row1['mobile'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Personal Identification Code</div><div  class="display_data_strong"><input type="text" name="personal_identification_code" value="<?php echo $row1['personal_identification_code'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">National Health Service Pers. Code</div><div  class="display_data_strong"><input type="text" name="national_health_service_pers_code" value="<?php echo $row1['national_health_service_pers_code'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">PIN code</div><div class="display_data_strong" ><input type="text" name="PIN_code" value="<?php echo $row1['PIN_code'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">E-mail *</div><div  class="display_data_strong"><input type="text" name="email" value="<?php echo $row1['email'] ?>"/>&nbsp;</div></div>


        <!--<div class="color_blue padding_title">ACCESS INFO</div>
        <!--  <div class="padding_5"> <div class="float_left edit_profile">User Id</div><div  class="display_data"><b></b></div></div>
      
          <div class="padding_5"> <div class="float_left edit_profile">Password</div><div  class="display_data">savan&nbsp;</div></div>
          <div class="padding_5"> <div class="float_left edit_profile">Password For Edit</div><div  class="display_data">&nbsp;</div></div>-->
        <script>
            function wl(val, type){
                var type= document.getElementById(type).value;
                if(type=='Kg')
                {
                    var value = document.getElementById(val).value /2.2046;
                    document.getElementById(val).value = value;
                }
                if(type=='Lbs'){
                    var value = document.getElementById(val).value * 2.2046;
                    document.getElementById(val).value = value;
                }
            }
        </script>

        <div class="color_blue padding_title">MORE INFO</div>
        <div class="padding_5"> <div class="float_left edit_profile">Body height in cm.</div><div  class="display_data"><input type="text" name="height" value="<?php echo $row1['height'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Body weight in KG / LBS</div><div  class="display_data"><input type="text" name="weight" id="1m0v" value="<?php echo $row1['weight'] ?>"/><select id="1m0t" onchange="wl('1m0v','1m0t')" name="wtype" ><option value="Kg" name="wtype" <?php if ($row1['wtype'] == 'Kg') { ?> selected="selected"  <?php } ?> >Kg</option><option value="Lbs" name="wtype" <?php if ($row1['wtype'] == 'Lbs') { ?> selected="selected"  <?php } ?>>Lbs</option></select>  &nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Group</div>
                        <div  class="display_data"> 
                <select name="group">
                    <?php
                    $bg1 = mysql_query("select * from fa_blood_groups") or die(mysql_error());
                    while ($row = mysql_fetch_array($bg1)) {?>
                    <option value="<?=$row['id']?>" <?php if($row1['group']==$row['id']){?> selected="selected"  <?php } ?> ><?=$row['Name']?></option>
                  <?php  }
                    ?>
                </select>
                
                &nbsp;</div>
        </div>
        <div class="padding_5"> <div class="float_left edit_profile">Religion</div>
            <div  class="display_data">
                <select name="religion">
                    <?php
                    $rg1 = mysql_query("select * from fa_religion ") or die(mysql_error());
                    while ($row2 = mysql_fetch_array($rg1)) {?>
                    <option value="<?=$row2['id']?>" <?php if($row1['religion']==$row2['id']){?> selected="selected"  <?php } ?>  ><?=$row2['name']?></option> 
                  <?php  }
                    ?>
                </select>
                &nbsp;
            </div>            
        </div>
        <div class="padding_5"> <div class="float_left edit_profile">Private Helath Insurance Company</div><div  class="display_data"><input type="text" name="private_health_insurance_company" value="<?php echo $row1['private_health_insurance_company'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Nr. Insurance Agreement</div><div  class="display_data"><input type="text" name="insurance" value="<?php echo $row1['insurance'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Insurance phone nr.</div><div  class="display_data"><input type="text" name="phone_insurance" value="<?php echo $row1['phone_insurance'] ?>"/>&nbsp;</div></div>        
        <div class="padding_5"> <div class="float_left edit_profile">Name Personal attending Doctor</div><div  class="display_data"><input type="text" name="name_personal_attending_doctor" value="<?php echo $row1['name_personal_attending_doctor'] ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Private practice phone nr.</div><div  class="display_data"><input type="text" name="private_practice_phone_nr" value="<?php echo $row1['private_practice_phone_nr']; ?>"/>&nbsp;</div></div>
        <div class="padding_5"> <div class="float_left edit_profile">Mobile phone nr.</div><div  class="display_data"><input type="text" name="mobile_phone_nr" value="<?php echo $row1['mobile_phone_nr'] ?>"/>&nbsp;</div></div>




        <?php
    }
    ?>
    <input type="hidden" name="actor" value="CHILD" />
    <input type="submit" value="Update"  class="ui-state-default ui-corner-all" />
</form>